import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:syn_4s/core/extension/int_extension.dart';
import 'package:syn_4s/core/viewmodel/about_us_view_model.dart';
import 'package:syn_4s/ui/widgets/custom_ui.dart';

import '../../shared/app_theme.dart';
import '../../widgets/shadow_container.dart';

class AboutUsContent extends StatelessWidget {
  AboutUsContent({super.key});

  final AboutUsViewModel viewModel = Get.find<AboutUsViewModel>();

  @override
  Widget build(BuildContext context) {
    return Container(
      height: double.infinity,
      decoration: const BoxDecoration(
        gradient: LinearGradient(
            colors: [AppTheme.bgStartColor, AppTheme.bgEndColor]),
      ),
      child: ShadowContainer(
        border: Border.all(color: AppTheme.orangeColor),
        margin: EdgeInsets.symmetric(horizontal: 12.px, vertical: 8.px),
        padding: EdgeInsets.only(left: 8.px, right: 8.px, top: 24.px),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Image.asset("assets/images/logo.png"),
            SizedBox(
              height: 40.px,
            ),
            Expanded(
              child: Obx(() {
                int size = viewModel.content.length;
                return ListView.builder(
                    itemCount: size,
                    itemBuilder: (ctx, index) {
                      return index < size - 2
                          ? buildContent(viewModel.content[index])
                          : Row(
                              children: [
                                getSvgPicture(
                                    index == size - 1
                                        ? "assets/images/email.svg"
                                        : "assets/images/phone.svg",
                                    22.px),
                                SizedBox(
                                  width: 2.px,
                                ),
                                buildContent(viewModel.content[index])
                              ],
                            );
                    });
              }),
            )
          ],
        ),
      ),
    );
  }

  Widget buildContent(String text) {
    return Text(
      text,
      style: TextStyle(color: AppTheme.threeColor, fontSize: 16.px),
    );
  }
}
